import controller.UserExisted;
import entity.Paper;
import entity.Subject;
import entity.User;
import util.OwnStorage;
import util.UserBind;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class StartMath {
  public static void main(String[] args) {
    Paper.PaperBuilder paperBuilder = Paper.builder();
    List<Subject> subjectList = new ArrayList<>();
    for (int i = 0; i < 3; i++) {
      subjectList.add(Subject.builder().num(i).content("test" + i).build());
    }
    Paper paper =
        paperBuilder
            .owner("hzy")
            .paperType("primary")
            .time("2021-9-23-23-38-50")
            .subjects(subjectList)
            .build();
    try {
      OwnStorage.saveStorage(paper);
    } catch (IOException e) {
      e.printStackTrace();
    }
    UserExisted userExisted = UserExisted.getExistedUser("张三1");
    if (userExisted == null) {
      System.out.println(123);
      return;
    }
    System.out.println(userExisted);
    User user = UserBind.bindUser(userExisted);
    System.out.println(user);
  }
}
